<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8" />
		<title>2.回调地狱</title>
		<script src="https://cdn.bootcdn.net/ajax/libs/axios/1.1.2/axios.js"></script>
		<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.1/jquery.js"></script>
	</head>
	<body>
		<script type="text/javascript" >

			new Promise((resolve,reject)=>{
				 axios.get('https://api.uixsj.cn/hitokoto/get?type=social').then(
					response => {
						console.log('ok1',response.data)
						resolve(response.data)
					},
					reason => {
						console.log('err1',reason)
						reject(reason)
					}
				 )
			}).then(
				value => {
					return axios.get('https://api.uixsj.cn/hitokoto/get?type=social')
				},
				reason => {
					console.log('不好意思，由于某种原因，第1次失败了')
					return new Promise(()=>{})
				}
			).then(
				response => {
					console.log('ok2',response.data)
					return axios.get('https://api.uixsj.cn/hitokoto/get?type=social')
				},
				reason => {
					console.log('不好意思，由于某种原因，第2次失败了')
					return new Promise(()=>{})
				}
			).then(
				response => {
					console.log('ok3',response.data)
				},
				reason => {
					console.log('不好意思，由于某种原因，第3次失败了')
					return new Promise(()=>{})
				}
			)
		</script>
	</body>
</html>